<?php

declare(strict_types=1);

namespace App\Request\Amount;

use Hyperf\Validation\Request\FormRequest;

class AmountLogSaveRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'amount' => 'required',
            'type' => 'required|in:1,2',
            'cate_id' => 'required',
            'account_id'=> 'required',
            'remark' => 'nullable',
            'save_date' => 'required'
        ];
    }

    public function messages(): array
    {
        return [
            'amount.required' => '请输入金额',
            'type.required' => '请选择类型',
            'type.in' => '请选择正确的类型',
            'cate_id.required' => '请选择类目',
            'save_date.required' => '日期不存在',
            'account_id.required' => '请选择账户',
        ];
    }
}
